package com.application.request;

import com.inboyu.admin.domain.BusinessType;
import com.inboyu.admin.domain.ResourceEntity;
import com.inboyu.admin.domain.ResourceId;
import com.inboyu.admin.domain.ResourceType;
import lombok.Data;

/**
 * 资源实体
 */
@Data
public class ResourceRequest {

    /**
     * 资源id
     */
    private String id;

    /**
     * 资源类型
     */
    private String type;

    /**
     * 资源名称
     */
    private String name;

    /**
     * 资源url地址
     */
    private String url;

    /**
     * 资源大小
     */
    private Long size;

    /**
     * 业务标识
     */
    private String businessType;

    /**
     * 到期时间
     */
    private Long expireTime;

    public ResourceEntity toResourceEntity() {
    	ResourceEntity resource = new ResourceEntity();
    	resource.setId(new ResourceId(id));
    	resource.setType(new ResourceType(type, ""));
    	resource.setName(name);
    	resource.setUrl(url);
    	resource.setSize(size);
    	resource.setBusinessType(new BusinessType(businessType, ""));
    	resource.setExpireTime(expireTime);
    	return resource;
    }
}
